package com.gasolinator.a.app.adapter;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by IntelliJ IDEA.
 * User: fjhidalgo
 * Date: 5/12/11
 * Time: 20:09
 * To change this template use File | Settings | File Templates.
 */
public class GasolinatorStationParcelable implements Parcelable {

    private double latitude;
    private double longitude;
    private int imageResource;
    private String name;
    private String address;
    private String city;
    private String province;
    private String timetable;
    private String isPublic;
    private String dateUpdated;
    private Double distance;

    public void setAddress(String address) {
        this.address = address;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public void setDateUpdated(String dateUpdated) {
        this.dateUpdated = dateUpdated;
    }

    public void setDistance(Double distance) {
        this.distance = distance;
    }

    public void setImageResource(int imageResource) {
        this.imageResource = imageResource;
    }

    public void setPublic(String aPublic) {
        isPublic = aPublic;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public void setTimetable(String timetable) {
        this.timetable = timetable;
    }

    /**
	 * Standard basic constructor for non-parcel
	 * object creation
	 */
	public GasolinatorStationParcelable() { ; };

	/**
	 *
	 * Constructor to use when re-constructing object
	 * from a parcel
	 *
	 * @param in a parcel from which to read this object
	 */
	public GasolinatorStationParcelable(Parcel in) {
		readFromParcel(in);
	}


	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {

		// We just need to write each field into the
		// parcel. When we read from parcel, they
		// will come back in the same order
        dest.writeDouble(latitude);
        dest.writeDouble(longitude);
        dest.writeInt(imageResource);
        dest.writeString(name);
        dest.writeString(address);
        dest.writeString(city);
        dest.writeString(province);
        dest.writeString(timetable);
        dest.writeString(isPublic);
        dest.writeString(dateUpdated);
        dest.writeDouble(distance);
    }

	/**
	 *
	 * Called from the constructor to create this
	 * object from a parcel.
	 *
	 * @param in parcel from which to re-create object
	 */
	private void readFromParcel(Parcel in) {

		// We just need to read back each
		// field in the order that it was
		// written to the parcel
        latitude = in.readDouble();
        longitude = in.readDouble();
        imageResource = in.readInt();
        name = in.readString();
        address = in.readString();
        city = in.readString();
        province = in.readString();
        timetable = in.readString();
        isPublic = in.readString();
        dateUpdated = in.readString();
        distance = in.readDouble();

    }

    /**
     *
     * This field is needed for Android to be able to
     * create new objects, individually or as arrays.
     *
     * This also means that you can use use the default
     * constructor to create the object and use another
     * method to hyrdate it as necessary.
     *
     * I just find it easier to use the constructor.
     * It makes sense for the way my brain thinks ;-)
     *
     */
    public static final Parcelable.Creator CREATOR =
    	new Parcelable.Creator() {
            public GasolinatorStationParcelable createFromParcel(Parcel in) {
                return new GasolinatorStationParcelable(in);
            }

            public GasolinatorStationParcelable[] newArray(int size) {
                return new GasolinatorStationParcelable[size];
            }
        };

    public double getLatitude() {
        return latitude;
    }

    public double getLongitude() {
        return longitude;
    }

    public int getImageResource() {
        return imageResource;
    }

    public String getName() {
        return name;
    }

    public String getAddress() {
        return address;
    }

    public String getCity() {
        return city;
    }

    public String getProvince() {
        return province;
    }

    public String getTimetable() {
        return timetable;
    }

    public String getIsPublic() {
        return isPublic;
    }

    public String getDateUpdated() {
        return dateUpdated;
    }

    public Double getDistance() {
        return distance;
    }


    public String getPrice(String combustible) {
        return "";
    }
}
